﻿<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	{include file="public/css"}
	<title>报名列表</title>
</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i>首页<span class="c-gray en">&gt;</span>
		报名管理
		<span class="c-gray en">&gt;</span>
		报名列表
		<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新">
			<i class="Hui-iconfont">
				&#xe68f;
			</i>
		</a>
	</nav>
	<div class="page-container">
		{if condition="session('atype') eq 1"}
		<form action="{:url('student_list')}" method="get">
			<div class="text-c">
				<select name="sid" class="input-text Wdate" style="width:100px" onchange="window.location=this.value">
					<option value="{:url('exam_list')}">批次选择</option>
					{volist name="pici" id="p"}
					<option value="{:url('exam_list')}?pid={$p.id}" {:$pid==$p.id?'selected':''}>{$p.name}</option>
					{/volist}
				</select>

			</div>
		</form>
		{/if}
		<div class="cl pd-5 bg-1 bk-gray mt-20">
			<span class="l">
				{if condition="session('atype') heq 0"}
				<a href="javascript:;" class="btn btn-danger radius delAll"><i class="Hui-iconfont">&#xe6e2;</i>批量删除</a>
				{/if}
				<!-- <a href="{:url('exam_add')}" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i>添加报名</a> -->
				<!-- <a href="{:url('exam_addAll')}" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 批量添加</a> -->
			</span>
			<span class="r">
				共有数据：<strong>{if condition="!empty($list)"}{$list->total()}{else /}0{/if}</strong>条
			</span>
		</div>
		<div class="mt-20">
			<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
				<thead>
					<tr class="text-c">
						{if condition="session('atype') heq 0"}
						<th width="25"><input type="checkbox" name="" value=""></th>
						{/if}
						<th width="50">ID</th>
						<th>学员姓名</th>
						<th>证书等级</th>
						<th>培训机构</th>
						<th>成绩</th>
						<th>考官</th>
						<th>状态</th>
						<th>排序</th>
						<!-- <th>报名时间</th> -->
						{if condition="session('atype') eq 1"}
						<th>操作</th>
						{/if}
					</tr>
				</thead>
				<tbody>
					{volist name="list" id="n"}
					<tr class="text-c">
						{if condition="session('atype') heq 0"}
						<td>
							<input type="checkbox" name="ids" value="{$n.id}">
						</td>
						{/if}
						<td>{$n.id}</td>
						<td>{$n.sname}</td>
						<td>{$n.cname}</td>
						<td>{$n.scname}</td>
						<td>{:$n.score!='缺考'?$n.score:'<font color="red">缺考</font>'}</td>
						<td>{$n.tname}</td>
						<td>
							{if condition="$n.score eq ''"}
							<font class="kaoshi" data-id="{$n.id}" data-state="{$n.state}" color="red">待考</font>
							{else/}
							<font class="kaoshi" data-id="{$n.id}" data-state="{$n.state}" color="green">正常</font>
							{/if}
						</td>
						<td>{$n.sort}</td>
					</tr>
					{/volist}
				</tbody>
			</table>
			<div class="page">{:$list->render()}</div>
		</div>
	</div>
	<!--_footer 作为公共模版分离出去-->
	{include file="public/js"}
	<!--/_footer 作为公共模版分离出去-->
	<!--请在下方写此页面业务相关的脚本-->
	<script type="text/javascript" src="/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
	<script type="text/javascript" src="/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="/admin/lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript">
		function del(id){
			var index=layer.confirm('确定删除数据？',{btn:['确定','取消']},function(){
				layer.close(index);
				$.post("{:url('del')}",{id:id,sql:'student_card',img:'yes'},function(res){
					console.log(res)
					if (res.state==200) {
						layer.msg(res.msg,{icon:1,time:1500},function(){
							window.location.reload();
						})
					}else{
						layer.msg(res.msg,{icon:2,time:1500});
					}
				})
			})
		}
		$(".delAll").click(function(){
			var ids='';
			$("input[name=ids]:checked").each(function(){
				if (ids!='') {
					ids+=','+$(this).val();
				}else{
					ids=$(this).val();
				}
			})
			if (ids!='') {
				del(ids);
			}else{
				layer.msg('删除数据不能为空',{icon:2,time:1500});
			}
		})
		$(".del").click(function(){
			var id=$(this).attr('data-id');
			del(id);
		})
		$(".kaoshi").click(function(){
			var state=$(this).attr('data-state');
				id=$(this).attr('data-id');
			var confirm=layer.confirm('确定更改学员状态',{btn:['确认','取消']},function(){
				layer.close(confirm);
				$.post("{:url('exam_state')}",{id:id},function(res){
					console.log(res);
					if (res.code==200) {
						layer.msg(res.msg,{icon:1,time:1500},function(){
							window.location.reload();
						})
					}else{
						layer.msg(res.msg,{icon:2,time:1500});
					}
				})
			})
		})
	</script>
</body>
</html>